import Taro from "@tarojs/taro";
import { View, Image } from "@tarojs/components";
import log from "../../assets/images/app_log.png";
import sign from "../../assets/images/app_sign.png";
import "./index.scss";
export default () => {
  const work = [
    {
      name: "多图表",
      url: "../multipleCharts/index",
      logo: log,
    },
    {
      name: "切页",
      url: "../cutoPageChart/index",
      logo: sign,
    },
  ];
  const goToPage = (url) => {
    Taro.navigateTo({
      url,
    });
  };
  const renderItem = (arr) => {
    return arr?.map((item) => {
      return (
        <View
          className="item"
          key={item.name}
          onClick={() => goToPage(item.url)}
        >
          <Image src={item.logo} />
          <View>{item.name}</View>
        </View>
      );
    });
  };
  return (
    <View className="container">
      <View className="sales-money">
        <View className="sales-money-title">
          <View className="sales-money-title-text">图表</View>
        </View>
        {renderItem(work)}
      </View>
    </View>
  );
};
